/*
 * @Author: zhudx
 * @Date: 2023-07-21 15:32:22
 * @LastEditors: zhudx
 * @LastEditTime: 2023-07-21 16:36:05
 * @FilePath: /grid-center-admin/src/components/ui/CustomChart/chartOptions/funnel.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

export const createFunnelOption = (
    barCount: number,
    colorList = ['#5470c6', '#91cc75', '#fac858', '#ee6666']
) => {
    const labelOption = {
        show: true
    };
    return {
        tooltip: {
            trigger: 'item'
        },
        legend: {},
        color: colorList,
        series: Array.from({ length: barCount }, (v) => v).map(() => {
            return {
                type: 'funnel',
                label: labelOption,
                left: '10%',
                top: 60,
                bottom: 60,
                width: '80%',
                min: 0,
                max: 100,
                minSize: '0%',
                maxSize: '100%',
                sort: 'descending',
                gap: 3,
                labelLine: {
                    length: 10,
                    lineStyle: {
                        width: 1,
                        type: 'solid'
                    }
                },
                itemStyle: {
                    borderColor: '#fff',
                    borderWidth: 1
                },
                emphasis: {
                    focus: 'series',
                    label: {
                        show: true,
                        fontSize: 20,
                        fontWeight: 'bold'
                    }
                },
                barWidth: 17
            };
        })
    };
};
